-
Notifications
You must be signed in to change notification settings - Fork 870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reorganize fmt.rs to provide correct logging location when using defmt #3065
Conversation
I've already tried this in the past, I ran into a few issues:
I personally think the The approach you're trying moves some shared stuff to |
Yeah I hear you. Tbh while doing this I run into so many weird issues that I feel the whole thing is super fragile. The name resolution system felt broken as I was doing this. I have no idea why the code in this PR works, but it does haha. I don't even understand how the current implementation on main works. I even feel like there might be compiler bugs or something, because the behavior I saw didn't make sense at all. For example, I added a
I don't think I saw this issue as you describe it.
I think this is a problem that exists with or without an I'm not very convinced whether this PR should be merged or not, but it does fix the location problem and it does remove a lot of duplicated code. |
because you haven't made it self-contained. by "self-contained" I mean crates can depend on just
no, with the code in git main you can make
you're trading "good" duplicated code that can be updated with a script (standalone I'd prefer to fix just the location problem without introducing |
EDIT: rust-lang/rust#126365 fixes it. |
Nope, wasn't aware of it but it looks like the better fix to me. |
I'll close this PR since it seems that collapse_debuginfo will take care of this more cleanly. |
This PR is an attempt to fix the log location shown in probe-rs when using defmt.
Right now, every log gets the location of the fmt wrapper macro where the defmt call is, something like:
With these changes, the logs should actually print the file and line number where the log is coming from.
I haven't thoroughly tested these changes, but they seem to work.
P.S. While working on this I thought maybe it'd be good to create an embassy-fmt crate or something, instead of having so much repetition.